/* $Id:chatlist.h jjs $ */
/*
   Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl>
   Part of the Moros Project http://moros.sourceforge.net/

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License.
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY.

   See the COPYING file for more details.
*/

#ifndef CHATLIST_H
#define CHATLIST_H

#include <gtkmm.h>
#include <libglademm.h>

/// Windows for a list of games

class chatlist : public Gtk::Window {
  public:
	chatlist(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> refGlade); ///< window
	virtual ~chatlist();  ///< remove the window data
	void clear();
	void record(std::string name, int members, std::string type, std::string status, std::string descr);

  protected:
	Glib::RefPtr<Gnome::Glade::Xml> m_refGlade;
	virtual void clicked_close();
	virtual void clicked_new();
	virtual void clicked_join();
	Gtk::Button* chatlist_close;
	Gtk::Button* chatlist_new;
	Gtk::Button* chatlist_join;
	Gtk::TreeView* chatlist_view;
	Glib::RefPtr<Gtk::ListStore> list_store;
	virtual void clicked_list(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);

    /// Definition of the columns on the screen
	struct ModelColumns : public Gtk::TreeModelColumnRecord {
    	Gtk::TreeModelColumn<Glib::ustring> name;
    	Gtk::TreeModelColumn<int> members;
    	Gtk::TreeModelColumn<Glib::ustring> type;
    	Gtk::TreeModelColumn<Glib::ustring> status;
    	Gtk::TreeModelColumn<Glib::ustring> descr;
    	ModelColumns()
		{
			add(name); add(members); add(type); add(status); add(descr);
		}
	};
	const ModelColumns cols;
};

#endif //CHATLIST_H
